24 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define D(x) cout << #x " is " << x << endl
28 const double EPS
= 1e-9;
29 int cmp(double x
, double y
= 0, double tol
= EPS
) {
30 return (x
<= y
+ tol
) ? (x
+ tol
< y
) ? -1 : 0 : 1;
33 const int MAXN
= 100005 * 2;
40 while (getline(cin
, s
)) {
41 printf("%s", s
.c_str());
44 reverse(s
.begin(), s
.begin() + n
);
47 for (int i
= 1; i
< 2 * n
+ 1; ++i
) {
49 while (p
[i
] > 0 and s
[i
] != s
[p
[i
]]) p
[i
] = p
[p
[i
] - 1];
50 if (s
[i
] == s
[p
[i
]]) p
[i
]++;
53 for (int i
= p
[2 * n
]; i
< n
; ++i
) {